#include <stdio.h>

void minmax(int a[], int len, int* min, int* max);

int main(void)
{
	char ac[] = { 0,1,2 };
	char* p = ac;
	printf("p  =%p\n", p);
	printf("p+1=%p\n", p + 1);
	int ai[] = { 0,1,2 };
	int* q = ai;
	printf("q  =%p\n", q);
	printf("q+1=%p\n", q + 1);
	return 0;
}

int main3(void)
{
	int a[] = { 5, 15, 34, 54, 14, 2, 52, 72 };
	//int*  p = &a[5];
	//printf("%d\n", p[-2]);

	int* p = a;
	printf("%d\n", p == a[0]);
	printf("%d\n", p == &a[0]);
	printf("%d\n", *p == a[0]);
	printf("%d\n", p[0] == a[0]);

	return 0;
}

int main2(void)
{
	int a[] = { 1,2,3,5,4,6,8,23,55 };
	int min, max;
	printf("main sizeof(a)=%lu\n", sizeof(a));
	printf("main a=%p\n", a);
	minmax(a, sizeof(a) / sizeof(int), &min, &max);
	printf("min=%d, max=%d", min, max);

	int* const q = &min;
	*q = 200;
	 
	const int* p = &a;

	return 0;
}

void minmax(int a[], int len, int* min, int* max) {
	int i;
	*min = *max = a[0];
	printf("minmax sizeof(a)=%lu\n", sizeof(a));
	printf("minmax a=%p\n", a);
	for (i = 1; i < len; ++i)
	{
		if (a[i] < *min)
			* min = a[i];
		else if (a[i] > *max)
			* max = a[i];
	}
}